#pragma once

using namespace System;
using namespace System::Runtime::InteropServices;

#define VPX_CODEC_DISABLE_COMPAT 1
#include<vpx\vpx_encoder.h>


namespace NVP8 
{
	static void ThrowOnError(int result, vpx_codec_ctx_t *ctx, const char *s) 
	{
		if (result == 0)
			return;

		const char *detail = vpx_codec_error_detail(ctx);
		String^ message = String::Format("%s: %s", gcnew String(s), gcnew String(vpx_codec_error(ctx)));
    
		throw gcnew InvalidOperationException(message);
	}
}